<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-do-edit" th:object="${tbBank}">
        <input type="hidden" name="bankId" th:value="*{bankId}"><!-- 主键 -->
        <div class="form-group">
            <label class="col-sm-3 control-label">名称:</label>
            <div class="col-sm-8"><input class="form-control" type="text" name="bankName" th:value="*{bankName}"></div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">
介绍:</label>
            <div class="col-sm-8"><input class="form-control" type="text" name="introduce" th:value="*{introduce}"></div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">电话:</label>
            <div class="col-sm-8"><input class="form-control" type="text" name="bankPhone" th:value="*{bankPhone}"></div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">资产:</label>
            <div class="col-sm-8"><input class="form-control" type="text" name="money" th:value="*{money}"></div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">利率:</label>
            <div class="col-sm-8"><input class="form-control" type="text" name="rate" th:value="*{rate}"></div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">债务:</label>
            <div class="col-sm-8"><input class="form-control" type="text" name="repayment" th:value="*{repayment}"></div>
        </div>
        <div class="form-group">
            <div class="form-control-static col-sm-offset-9">
                <button type="submit" class="btn btn-primary">提交</button>
                <button onclick="$.modal.close()" class="btn btn-danger" type="button">关闭</button>
            </div>
        </div>
    </form>
</div>
<div th:include="include::footer"></div>
<script th:src="@{/ajax/libs/select/select2.js}"></script>
<script type="text/javascript">
    layui.use('laydate', function () {
        var laydate = layui.laydate;//时间选择器
        laydate.render({
            elem: '#inDate', type: 'date'
        });
    });
    var prefix = "/tbBank"
    $("#form-do-edit").validate({
        rules: {
            bankId: {required: true},
        },
        messages: {
            "bankId": {remote: "必填"}
        },
        submitHandler: function (form) {
            $.operate.save(prefix + "/editSave", dataEdit());
        }
    });

    function dataEdit() {
        var bankId = $("input[name='bankId']").val();
        var bankName = $("input[name='bankName']").val();
        var introduce = $("input[name='introduce']").val();
        var bankPhone = $("input[name='bankPhone']").val();
        var money = $("input[name='money']").val();
        var rate = $("input[name='rate']").val();
        var repayment = $("input[name='repayment']").val();
        return {
            "bankId":bankId,
            "bankName":bankName,
            "introduce":introduce,
            "bankPhone":bankPhone,
            "money":money,
            "rate":rate,
            "repayment":repayment,
        }
    }
</script>
</body>
</html>